//自定义指令-全局防抖
export default {
  //绑定到元素触发的钩子函数(el当前对象,binding当前绑定属性)
  inserted: function (el, binding) {
    let timer;
    //监听当前元素点击事件
    el.addEventListener("click", () => {
      clearTimeout(timer);
      timer = setTimeout(() => {
        // binding.value 可获取指令绑定的值
        binding.value();
      }, 500);
    });
  },
};
